//
//  TMGHelpTableViewCell.m
//  TMGold
//
//  Created by Mac on 2017/12/11.
//  Copyright © 2017年 tangmu. All rights reserved.
//

#import "TMGCommentTableViewCell.h"
@interface  TMGCommentTableViewCell()
@property(nonatomic, strong) STLabel                     *nameLabel;
@property(nonatomic, strong) STLabel                     *contenLabel;
@property(nonatomic, strong) STLabel                     *timeLabel;


@end

@implementation TMGCommentTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 130;
}
#pragma mark --subView
- (void)configSubView{
    self.backgroundColor = [UIColor whiteColor];
    
    self.nameLabel = [[STLabel alloc] initWithFrame:CGRectMake(15,10, UIScreenWidth - 30, 20)
                                                text:@"18380461776"
                                           textColor:TM_orangeColor
                                                font:15
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    self.nameLabel.numberOfLines = 0;
    [self addSubview:self.nameLabel];
    
    
    
    self.contenLabel = [[STLabel alloc] initWithFrame:CGRectMake(self.nameLabel.left, self.nameLabel.bottom + 5 , UIScreenWidth - 30, 30)
                                               text:@"dsfsdfds第三方第三方多少范第三方是的范德萨范德萨范德萨发水电费德萨范德萨发收到防守打法斯蒂芬斯蒂芬水电费当时的双方"
                                          textColor:TM_secendTextColor
                                               font:14
                                        isSizetoFit:NO
                                      textAlignment:NSTextAlignmentLeft];
     self.contenLabel.numberOfLines = 0;
    [NSString lableAutoAdjustheightWithLabel:self.contenLabel];
    [self addSubview:self.contenLabel];
    
    
    
    self.timeLabel = [[STLabel alloc] initWithFrame:CGRectMake(15, self.contenLabel.bottom + 5, UIScreenWidth-30, 30)
                                               text:@"2017年12月13日10:51:46"
                                          textColor:TM_secendTextColor
                                               font:14
                                        isSizetoFit:NO
                                      textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.timeLabel];
    
    
    self.commentButton  = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)
                                                    title:nil
                                               titleColor:nil
                                                titleFont:0
                                             cornerRadius:0
                                          backgroundColor:nil
                                          backgroundImage:nil
                                                    image:[UIImage imageNamed:@"评论拷贝"]];
    self.commentButton.centerY = self.timeLabel.centerY;
    self.commentButton.right = UIScreenWidth - 15;
    self.commentButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.commentButton.userInteractionEnabled = NO;
    [self addSubview:self.commentButton];
    
    
    self.goodButton  = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)
                                                     title:@"0"
                                                titleColor:SecendTextColor
                                                 titleFont:14
                                              cornerRadius:0
                                           backgroundColor:nil
                                           backgroundImage:nil
                                                     image:[UIImage imageNamed:@"点赞_未选中"]];
    self.goodButton.centerY = self.timeLabel.centerY;
    self.goodButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
    [self.goodButton setImage:[UIImage imageNamed:@"点赞_选中"] forState:UIControlStateSelected];
    self.goodButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.goodButton.right = self.commentButton.left - 15;
    [self addSubview:self.goodButton];
    
    

}
- (void)setModel:(TMGCommentModel *)model{
    _model = model;
    self.nameLabel.text = model.u_mobile;
    self.contenLabel.text = model.content;
    [NSString lableAutoAdjustheightWithLabel:self.contenLabel];
    
    self.timeLabel.top = self.contenLabel.bottom + 5;
    self.timeLabel.text = model.create_at;
    
    self.goodButton.centerY = self.timeLabel.centerY;
    self.commentButton.centerY = self.timeLabel.centerY;
    self.goodButton.selected = model.is_thumb.boolValue;
    [self.goodButton setTitle:model.thumbs.description forState:UIControlStateNormal];
}
@end






